$("#addadmin").click(function() {
		$.ajax({
			url:"http://127.0.0.1:16200/adadmi",
			method: "get",
			dataType: "json",
			data:{
				name:document.getElementById("name").value,
				dizi:document.getElementById("dizi").value
			},
			success:function(data){
				xxx(0)
			
		
			},
			errer:function(){
				alert("no")
			}
			
		})
		
		
	})

	function xxx(x) {
		if(x<0){
			alert("这是第一页");
			return;
		}
		var stc="";	
		$.ajax({
			url:"http://127.0.0.1:16200/admin",
			method: "get",
			dataType: "json",
			data:{
				feiye:x
			},
			success:function(data){
			
				
				var zt;
				var zz;
				
				for(var i=0;i<data.length;i++){
					
					 if(data[i].status==1){
						 zt="激活";
						 zz="关闭"
					 }else{
						 zt="关闭";
						 zz="激活";
					 }
					stc+="<tr>" +
						 "<td class='text-center' >" + data[i].id + "</td>" +  
					    "<td class='text-center'>" + data[i].name + "</td>" +  
						 "<td class='text-center'>" + data[i].ress + "</td>" +  
						  "<td class='text-center'>" + zt + "</td>" +  
						  ' <td class="text-center">  <button class="btn btn-primary btn-sm" data-toggle="modal" data-target="#layer" onclick="cc(this)" >'+zz+'</button>'+

						  '</td>'
					     "</tr>";

				}
				
				
				// if(dan>data[0].totalPageNum){
				// 	alert("这是最后一页")
				// 	return;
				// }
				// alert(data[0].totalPageNum)
				// dan=data[0].totalPageNum;
			 
				document.getElementById("www").innerHTML=stc
				document.getElementById("fei").innerHTML="<button onclick='xxx("+(x-4)+")'>上一页</button> <button onclick='xxx("+(x+4)+")'>下一页</button>"
			
			},
			errer:function(){
				alert("no")
			}
			
		})
	}
	xxx(0)
		function cc (x) {
			var tr=$(x).closest("tr");
			var coll=tr.find("td:eq(0)").text();
			var co=tr.find("td:eq(3)").text();
			if(co=="关闭"){
				q=1;
			}else{
				q=0;
			}
			$.ajax({
				url:"http://127.0.0.1:16200/adxiu",
				method: "get",
				dataType: "json",
				data:{
					id:coll,
					zt:q
				},
				success:function(data){
					xxx(0);
				},
				errer:function(){
					alert("no");
				}})
		}